#include "uniform_socket.h"

int uniform_socket_close(uniform_socket_t sock) {
	int status = 0;

#if defined(__linux__) || defined(__APPLE__)
	status = shutdown(sock, SHUT_RDWR);
    if (status == 0) { status = close(sock); }
#else
    status = shutdown(sock, SD_BOTH);
	if (status == 0) { status = closesocket(sock); }
#endif

	return status;
}